Crt key and get artifacts by path#302
Open
thebravoman wants to merge 3 commits into
Open
Conversation
added 2 commits
October 15, 2020 00:24
…en sending a post for a build. The post will include the same cookie
1. Crk and Key
In a jenkins instance that is behind an https proxy the certificate might be restricted only to peers that have a certificate issued by the authority.
The jenkins_api_client should send the certificate issued by the authority with the call.
The perpose of the :crt and :key file arguments is to allow for the client to include its crt and key file when making the request and in this way authorizing to the https service.
2. Verify model
The certificate of the https service might be self-signed so I have added an option of ":verify_mode" that allows you to override the default verify_mode used to make the connections
In this way existing clients will not get a different behaviour while new clients could specify their verify_mode
Example for calling with crt, key and verify_mode
```
# This crt and key files could be generated with
# openssl pkcs12 -in path.p12 -out newfile.crt.pem -clcerts -nokeys
# openssl pkcs12 -in path.p12 -out newfile.key.pem -nocerts -nodes
# This of course is only if you have p12 file.
JenkinsApi::Client.new(:server_url=>the_url,
crt: the_crt,
key: the_key,
ssl: true,
verify_mode: OpenSSL::SSL::VERIFY_NONE,
:username=>ENV["JENKINS_USERNAME"],
:password=>ENV["JENKINS_PASSWORD"])
```
3. get_artifcat_by_path
Sometime you need to get not all the artifacts but a specific artifact. This new method allows you to.
This is need when the build produces to many artifacts and you only want to download one of them as you only need one of them.
grosser
approved these changes
Mar 20, 2023
Collaborator
grosser
left a comment
There was a problem hiding this comment.
this looks neat, can you add some basic unit tests ?
Collaborator
|
(and rebase so CI runs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Crt and Key
Verify model
get_artifact_by_path